export interface User {
  id: string;
  name: string;
}
interface FromProps {
  users: User[];
  person: {
    name: string;
    personId: string;
  };
  setPerson: (param: FromProps['person']) => void;
}

const Form: React.FC<any> = ({ person, users, setPerson }: FromProps) => {
  return (
    <form>
      <div>
        <input
          type="text"
          value={person.name}
          onChange={(e) => setPerson({ ...person, name: e.target.value })}
        />
        <select
          value={person.personId}
          onChange={(e) =>
            setPerson({
              ...person,
              personId: e.target.value,
            })
          }
        >
          <option value={''}>负责人</option>
          {users.map((user) => (
            <option key={user.id} value={user.id}>
              {user.name}
            </option>
          ))}
        </select>
      </div>
    </form>
  );
};

export default Form;
